﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace TopShooter
{
	public struct Coordinate
	{
		public int Column;
		public int Row;

		public Coordinate(int col, int row)
		{
			Column = col;
			Row = row;
		}
		public Vector2 ToLocation()
		{
			float x = Tile.HalfSize.X + (Column * Tile.Size.X);
			float y = Tile.HalfSize.Y + (Row * Tile.Size.Y);
			return new Vector2(x, y);
		}
		static public Coordinate FromLocation(Vector2 pos)
		{
			int column = (int)Math.Floor(pos.X / Tile.Size.X);
			int row = (int)Math.Floor(pos.Y / Tile.Size.Y);
			return new Coordinate(column, row);
		}

		public override string ToString()
		{
			return "Coord(" + Column + ", " + Row + ")";
		}
	}
}
